package com.wh.hotel.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author luweije
 */
@Getter
@AllArgsConstructor
public enum HotelStatusEnum {

    NORMAL(1, "正常"),
    OFFLINE(2, "下架"),
    ;


    private final int code;
    private final String desc;

    public static HotelStatusEnum parse(Integer code) {
        if (code == null) {
            return null;
        }
        for (HotelStatusEnum statusEnum : HotelStatusEnum.values()) {
            if (statusEnum.getCode() == code) {
                return statusEnum;
            }
        }
        return null;
    }

}
